package top.malaoshi.webmvc.parameter;

import top.malaoshi.webmvc.info.MethodsArgumentInfo;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class StringArrayResolver extends AbstractResolver implements RequestParamAndMethodArgsResolver {
    @Override
    public Object resolver(HttpServletRequest request, HttpServletResponse response , MethodsArgumentInfo mai) {
        checkNameAndValue(mai);
        String parameterName = getName(mai);
        String[] ret = request.getParameterValues(parameterName);
        checkRequired(ret,mai);
        return ret;
    }
}
